<?php
class SqlClass {
	/**
	 * Thuc thi cau lenh sql, neu gap loi thi chuyen den trang error
	 * @param $sqlStr:  cau lenh sql thuc thi
	 * @return $result
	 */
	function executeSql($sqlStr) {
		$result = mysql_query ( $sqlStr ) ;
		return $result;
	}
	/**
	 * Lay ten cua group theo groupd_id, truong hop hop khong ton tai group thi tra ve rong
	 * @param unknown_type $group_id
	 */
	function getGroupNameById($group_id) {
		if (isset ( $group_id ) && strlen ( trim ( $group_id ) ) > 0) {
			$sqlStr = 'select name from ' . Tables::$HL_GROUPS . ' where id = ' . $group_id;
			$result = $this->executeSql ( $sqlStr );
			$rowNum = mysql_num_rows ( $result );
			if ($rowNum > 0) {
				$row = mysql_fetch_array ($result);
				return $row["name"];
			}
		}
		return "";
	}
}
?>